home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_weap_pistol.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
4KB
|
209 lines
# Jones 3D Cog Script
#
# weap_Pistol.cog
#
# This COG controls Indy's 1917 Smith & Wesson revolver. It's always with Indy (except on
# the SEA level), never runs out of ammo, and stays crunchy in milk.
#
# [RandyT]
#
# (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
#
# ===================================================================
symbols
message startup
message fire
message aim
message activated
message deactivated
message selected
message deselected
message callback
sound bang=gen_pistol_fire.wav local # Autoloaded
sound pull=gen_pistol_pull.wav local # Autoloaded
sound put=gen_pistol_put.wav local # Autoloaded
template projectile=+pistol local # Autoloaded
template smoke1=+pistol_smoke1 local # Autoloaded
template smoke2=+pistol_smoke2 local # Autoloaded
thing player local
thing bullet local
flex aimFOV=10.0 local
flex aimMax=90.0 local
flex aimWait=0.2 local
flex fireWait=0.52 local
int handNode local
int holsterMesh local
int weaponNum=3 local
int callNum local
int bJacketIndy=0 local
int bActivated=0 local
vector firePos local
end
# ===================================================================
code
startup:
player = GetLocalPlayerThing();
handNode = GetNodeByName(player, "inrhand");
# Indy is wearing the Colt 45 by default, but ONLY if he's in his shirt
bJacketIndy = IsThingModelName(player, "gen_in.3do");
if (!bJacketIndy)
{
holsterMesh = GetMeshByName(player, "inholster");
LoadHolsterModel(weaponNum, "holster_in_revolver.3do");
if (GetLastPistol(player) == weaponNum)
{
SetHolsterModel(player, weaponNum, holsterMesh);
}
}
return;
# -------------------------------------------------------------------
fire:
# Fire away...
firePos = GetThingJointPos(player, handNode);
bullet = FireProjectile(player, projectile, bang, 65, firePos, '3.0 -6.5 0.0', 1.0, 0x2a0, aimFOV, aimMax);
if (Rand() < 0.5) CreateThing(smoke1, bullet);
else CreateThing(smoke2, bullet);
SetFireWait(player, fireWait);
return;
# -------------------------------------------------------------------
aim:
if (GetParam(0))
{
if (!IsAiming(player) && !bActivated)
{
while ((PlayMode(player, 63, 0) == -99) && (!bActivated))
{
Sleep(0.01);
}
}
}
else if (IsModePlaying(player, 63) && !bActivated)
{
SetAimWait(player, aimWait);
StopMode(player, 63, aimWait);
}
return;
# -------------------------------------------------------------------
activated:
bActivated = 1;
SetAimWait(player, aimWait);
if (!IsAiming(player))
{
while (PlayMode(player, 63, 0) == -99)
{
Sleep(0.01);
}
}
ActivateWeapon(player, aimWait);
return;
# -------------------------------------------------------------------
deactivated:
bActivated = 0;
if (!IsAiming(player))
{
SetAimWait(player, aimWait);
StopMode(player, 63, aimWait);
}
DeactivateWeapon(player);
return;
# -------------------------------------------------------------------
selected:
SetMountWait(player, 0.7);
SetArmedMode(player, 2);
SetCurWeapon(player, weaponNum);
SetThingFireOffset(player, '0.06 0.015 0.002');
CaptureThing(player);
PlayMode(player, 62, 0);
return;
# -------------------------------------------------------------------
deselected:
if (IsAiming(player))
{
SetAimWait(player, aimWait);
StopMode(player, 63, aimWait);
}
SetMountWait(player, 1.07);
StopMode(player, 62, 0);
CaptureThing(player);
PlayMode(player, 64, 0);
SetArmedMode(player, 0);
return;
# -------------------------------------------------------------------
callback:
callNum = GetParam(1);
ReleaseThing(player);
if (callNum == 28)
{
if (!bJacketIndy) ResetHolsterModel(player, 2);
PlaySoundThing(pull, player, 1, -1, -1, 0x880);
SetWeaponModel(player, weaponNum);
}
else if (callNum == 29)
{
if (!bJacketIndy) SetHolsterModel(player, weaponNum, holsterMesh);
PlaySoundThing(put, player, 1, -1, -1, 0x880);
ResetWeaponModel(player);
}
return;
end